from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class knowledge_base_fake :
    def __init__ ( self ) :
        self . _store_kb_type = None
        self . _request_is_kb_type_stored = None
        self . _request_kb_types_starting_with = None
    def store_kb_type ( self , kb_type ) :
        self . _store_kb_type = kb_type
    def request_is_kb_type_stored ( self , kb_type ) :
        self . _request_is_kb_type_stored = kb_type
    def request_kb_types_starting_with ( self , prefix ) :
        self . _request_kb_types_starting_with = prefix

class arbitrary_module_fake :
    pass

class mediator_knowledge_base_tests : 
    'mediator_knowledge_base'
    def __init__ ( self , test ) :
        self . _test = test
        self . _knowledge_base = knowledge_base_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'knowledge_base' 
            , self . _knowledge_base 
            , arbitrary_module_fake
            ) )
    def test_store_kb_type ( self ) :
        self . _mediator . store_kb_type ( 'my type' )
        self . _test . assume_equal ( self . _knowledge_base . _store_kb_type , 'my type' )
    def test_request_is_kb_type_stored ( self ) :
        self . _mediator . request_is_kb_type_stored ( 'my type' )
        self . _test . assume_equal ( self . _knowledge_base . _request_is_kb_type_stored , 'my type' )
    def test_request_kb_types_starting_with ( self ) :
        self . _mediator . request_kb_types_starting_with ( 'my prefix' )
        self . _test . assume_equal ( self . _knowledge_base . _request_kb_types_starting_with , 'my prefix' )
